﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace B4ALL.JITL
{
    [Serializable]
    public class JITLReference
    {

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="methodSrc">MethodBase</param>
        /// <param name="methodParametersSrc"></param>
        public JITLReference(MethodInfo methodSrc, Object[] methodParametersSrc)
        {
            if (methodSrc == null)
                throw new JITLException();

            name = methodSrc.Name;
            declaringType = methodSrc.DeclaringType;
            isStatic = methodSrc.IsStatic;
            isGeneric = methodSrc.IsGenericMethod;
            methodParameters = methodParametersSrc;
            methodParametersInfo = methodSrc.GetParameters();
            genericArguments = methodSrc.GetGenericArguments();
        }

        private Object[] methodParameters = null;
        public Object[] MethodParameters
        {
            get
            {
                return methodParameters;
            }
        }

        private ParameterInfo[] methodParametersInfo = null;
        public ParameterInfo[] MethodParametersInfo
        {
            get
            {
                return methodParametersInfo;
            }
        }

        private String name;
        public String Name
        {
            get
            {
                return name;
            }
        }

        private Boolean isStatic;
        public Boolean IsStatic
        {
            get
            {
                return isStatic;
            }
        }

        private Boolean isGeneric;
        public Boolean IsGeneric
        {
            get
            {
                return isGeneric;
            }
        }

        private Type[] genericArguments = null;
        public Type[] GenericArguments
        {
            get
            {
                return genericArguments;
            }
        }

        private Type declaringType;
        public Type DeclaringType
        {
            get
            {
                return declaringType;
            }
        }
    }
}